package
        com.zzc.fee.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hos.entity.his.Registration;
import com.zzc.fee.mapper.RegistrationMapper;
import com.zzc.fee.service.WorkloadService;
import com.zzc.fee.vo.RegistrationVo;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;

/**
 * @author：xIAO_ZHOU_TX
 * @date：Created in 2023/12/25 11:16
 * @description：
 * @modified By：
 * @version:
 */
@Service
public class WorkloadServiceImpl implements WorkloadService {
    @Resource
    private RegistrationMapper registrationMapper;
    @Override
    public List<Registration> queryWorkload(RegistrationVo registrationVo) {
        LambdaQueryWrapper<Registration> wrapper =new LambdaQueryWrapper<>();
        //医生姓名
        if(StringUtils.hasText(registrationVo.getDoctorName())) {
            wrapper.like(Registration::getDoctorName, registrationVo.getDoctorName());
        }
        //接诊时间
        if(Objects.nonNull(registrationVo.getDateRange())){
            wrapper.between(Registration::getVisitDate,registrationVo.getDateRange()[0],registrationVo.getDateRange()[1]);
        }
        return registrationMapper.selectList(wrapper);
    }

    @Override
    public List<Registration> queryWorkloadStat(RegistrationVo registrationVo) {
        return registrationMapper.queryWorkloadStat(registrationVo.getUserId(),registrationVo.getDateRange());
    }
}